home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Freeware / DiskMaster / Rexx / DMFilter.rexx < prev    next >
OS/2 REXX Batch file  |  2002-10-27  |  2KB  |  61 lines

  1. /* $VER: DMFilter.rexx 1.2 (25.7.98) by J. Tierney, Nils Goers
  2.  
  3.   DiskMaster II Filter  v1.2
  4.   7/25/98  J. Tierney, Nils Goers
  5.  
  6.   Purpose:  Filters the source directory listing to display only certain files.
  7.  
  8.   Usage:  DMFilter.rexx [pattern]
  9.  
  10.         pattern - Only files matching this pattern will be displayed.
  11.                  If no pattern is given, a requester will pop up asking for
  12.                  one.
  13.  
  14.   Note:  To get a complete listing again, either "NewDir %p", call
  15.         DMFilter.rexx again with a pattern of "*", or activate the window's
  16.         string gadget and press <RETURN>.
  17.  
  18.  
  19.   Examples:
  20.     AddCmd Filter, 10, Rexx DMFilter.rexx
  21.  
  22.     AddCmd Only Icons, 10, REXX DMFilter.rexx *.info
  23.  
  24.  
  25.   History:
  26.     - 1.2 (07/25/98)
  27.       - Small improvements to the way the last-used pattern is saved (uses
  28.        the clip list), & automatically gets the DM port name.
  29.  
  30.     - 1.1 (07/24/98) - By Nils Goers
  31.       - The last-used pattern is saved, & used the next time the script is run.
  32.       - Bug fix:  Canceling the requester no longer causes the source window
  33.        to revert to the volume/device list.
  34.  
  35.     - 1.0 (02/02/98)
  36. */
  37.  
  38. OPTIONS RESULTS
  39.  
  40. PARSE ARG pat
  41.  
  42. filterclip = 'DMFilterPat.' || ADDRESS()
  43.  
  44. STATUS P
  45. dir = result
  46. IF RIGHT(dir, 1) ~= ':' THEN dir = dir || '/'
  47.  
  48. IF pat = '' THEN DO
  49.   pat = GETCLIP(filterclip)
  50.   IF pat = '' THEN pat = '*'
  51.  
  52.   'CONFIRM "Enter filter pattern:" Okay Cancel' pat
  53.   IF rc = 1 THEN EXIT 0
  54.   pat = result
  55.  
  56.   CALL SETCLIP(filterclip, pat)
  57. END
  58.  
  59. dir = dir || pat
  60. 'NEWDIR' dir
  61.